page.tsx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. "use client";
  2. import { userInfoApi } from "@/api/login";
  3. import { getUserMoneyApi, UserVipInfo } from "@/api/user";
  4. import { server } from "@/utils/client";
  5. import { useRequest } from "ahooks";
  6. import ItemCom from "./component/ItemCom";
  7. import ModalCom from "./component/ModalCom";
  8. import "./page.scss";
  9. import { ProfileHeader } from "./ProfileHeader";
  10. /**
  11. * @description 前台用户VIP信息 接口地址:https://app.apifox.com/link/project/4790544/apis/api-201160713
  12. */
  13. const getVipApi = async () => {
  14. return server
  15. .request<UserVipInfo>({
  16. url: "/v1/api/user/user_vip_info",
  17. method: "POST",
  18. })
  19. .then((res) => {
  20. if (res.code === 200) return res.data;
  21. });
  22. };
  23. const Profile = () => {
  24. const { data: userInfo } = useRequest<any, any>(userInfoApi, {
  25. pollingErrorRetryCount: 1,
  26. });
  27. const { data: userMoney } = useRequest<any, any>(getUserMoneyApi, {
  28. pollingErrorRetryCount: 1,
  29. pollingWhenHidden: false,
  30. });
  31. const { data: userVip } = useRequest<any, any>(getVipApi, {
  32. pollingErrorRetryCount: 1,
  33. });
  34. return (
  35. <div className="profile-box">
  36. <ProfileHeader
  37. userInfo={userInfo?.data}
  38. userMoney={userMoney?.data}
  39. userVip={userVip}
  40. />
  41. <ItemCom />
  42. <ModalCom />
  43. </div>
  44. );
  45. };
  46. export default Profile;